
<template>
  <div class="b-scene-btn" :class="{ active }" @click="handleClick">
    <div class="b-scene-btn-circle"></div>
    <div class="b-scene-btn-circle1">
      <i :class="icon" class="iconfont"></i>
    </div>
    <div class="b-scene-btn-line"></div>
    <div class="b-scene-btn-line1"></div>
    <div class="b-scene-btn-text">{{text}}</div>
  </div>
</template>
<script setup lang="ts">
defineProps({
  icon: {
    type: String,
    default: ''
  },
  active: {
    type: Boolean,
    default: false
  },
  text: {
    type: String,
    default: ''
  }
})
</script>
<style scoped lang="scss">
.b-scene-btn{
  position: relative;
  width: 60px;
  height: 100px;
  overflow: hidden;
  transition: all 0.5s ease-in-out;
  cursor: pointer;
  &:hover, &.active{
    width: 160px;
    .b-scene-btn-circle{
      animation: rotate1 0.5s ease-in-out 1 forwards;
    }
  }
  &.active{
    .iconfont{
      color: var(--el-color-primary);
      font-size: 18px;
    }
    .b-scene-btn-circle1::after{
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: url('@/assets/images/bbtn/circle1.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      z-index: 0;
      animation: rotate 4s linear infinite;
    }
  }
  .b-scene-btn-circle{
    position: relative;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    background-image: url('@/assets/images/bbtn/circle.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    animation: rotate1-1 0.5s ease-in-out 1 forwards;
  } 
  .b-scene-btn-circle1{
    position: absolute;
    top: 8px;
    left: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('@/assets/images/bbtn/bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
  } 
  .b-scene-btn-line{
    position: absolute;
    top: 40px;
    left: 65px;
    width: 80px;
    height: 7px;
    background-image: url('@/assets/images/bbtn/line.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
  }
  .b-scene-btn-line1{
    position: absolute;
    top: 40px;
    left: 148px;
    width: 4px;
    height: 1px;
    background-image: url('@/assets/images/bbtn/line1.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    animation: glint 0.5s linear infinite;
  }
  .b-scene-btn-text{
    position: absolute;
    padding-left: 8px;
    top: 25px;
    left: 65px;
    width: 72px;
    font-size: 12px;
    color: var(--el-color-primary);
    text-align: center;
    line-height: 1em;
    font-family: 'LianMengQiYiLuShuaiZhengRuiHeiTi';
    letter-spacing: 1px;
  }  
}

@keyframes rotate {
  0%{
    transform: rotate(0deg);
  }
  100%{
    transform: rotate(360deg);
  }
}

@keyframes rotate1 {
  0%{
    opacity: 0;
    transform: rotate(180deg) scale(0.7);
  }
  100%{
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

@keyframes rotate1-1 {
  0%{
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
  100%{
    opacity: 0;
    transform: rotate(180deg) scale(0.7);
  }
}

@keyframes glint {
  0%{
    opacity: 0.3;
  }
  50%{
    opacity: 1;
  }
  100%{
    opacity: 0.3;
  }
}
</style>

